package com.niiwoo.civet.trade.service.dubbo.configure;

import com.alibaba.dubbo.config.annotation.Service;
import com.niiwoo.civet.trade.dao.entity.PromptMsgConfig;
import com.niiwoo.civet.trade.dto.common.PromptMsgConfigDTO;
import com.niiwoo.civet.trade.service.configure.PromptMsgConfigDubboService;
import com.niiwoo.civet.trade.service.local.configure.PromptMsgConfigService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by HuangMin on 2018/5/15.
 */
@Service(version = "1.0.0")
public class PromptMsgConfigDubboServiceImpl implements PromptMsgConfigDubboService {

    @Autowired
    PromptMsgConfigService promptMsgConfigService;

    @Override
    public List<PromptMsgConfigDTO> selectListByPrimaryKey() {
        List<PromptMsgConfigDTO> promptMsgConfigDTOList = new ArrayList<>();
        List<PromptMsgConfig>  promptMsgConfigList = promptMsgConfigService.selectListByPrimaryKey();
        promptMsgConfigList.forEach(p -> {
            PromptMsgConfigDTO promptMsgConfigDTO = new PromptMsgConfigDTO();
            promptMsgConfigDTO.setPageId(p.getPageId());
            promptMsgConfigDTO.setStatus(p.getStatus());
            promptMsgConfigDTO.setConfigId(p.getConfigId());
            promptMsgConfigDTO.setPromptMsg(p.getPromptMsg());
            promptMsgConfigDTO.setCreateTime(p.getCreateTime());
            promptMsgConfigDTO.setUpdateTime(p.getUpdateTime());
            promptMsgConfigDTO.setConfigSceneDesc(p.getConfigSceneDesc());
            promptMsgConfigDTO.setCreateManagerId(p.getCreateManagerId());
            promptMsgConfigDTO.setUpdateManagerId(p.getUpdateManagerId());
            promptMsgConfigDTO.setCreateManagerName(p.getCreateManagerName());
            promptMsgConfigDTO.setUpdateManagerName(p.getUpdateManagerName());
            promptMsgConfigDTOList.add(promptMsgConfigDTO);
        });
        return promptMsgConfigDTOList;
    }
}
